<?php
/**
 * User Model
 *
 * Zie ook:
 * http://framework.zend.com/manual/en/learning.quickstart.create-model.html
 *
 * @author     Olivier Parent
 * @copyright  Copyright (c) 2011 Artevelde University College Ghent
 */
class Application_Model_User extends Ahs_Model
{

    /**
     * @var integer
     */
    protected $_id;
    /**
     * @var string
     */
    protected $_email;
    /**
     * @var string
     */
    protected $_password;
    /**
     * @var string
     */
    protected $_givenname;
    /**
     * @var string
     */
    protected $_familyname;
    /**
     * @var DateTime
     */
    protected $_dob;
    /**
     * @var string
     */
    protected $_gender;    
    

    #TIP: Gebruik ALT+INSERT (Win) of CTRL+i (Mac) om getters en setters te genereren
    /**
     * @return integer
     */
    public function getId() {
        return $this->_id;
    }

    /**
     * @param string $_id
     */
    public function setId($_id)
    {
        $this->_id = $_id;
    }

    /**
     * @return string
     */
    public function getEmail()
    {
        return $this->_email;
    }

    /**
     * @param string $email
     */
    public function setEmail($email)
    {
        $this->_email = $email;
    }

    /**
     * @return string
     */
    public function getPassword()
    {
        return $this->_password;
    }

    /**
     * @param string $password
     */
    public function setPassword($password)
    {
        $this->_password = Ahs_Utility::hash($password);
    }

    /**
     * @return string
     */
    public function getGivenname()
    {
        return $this->_givenname;
    }

    /**
     * @param string $givenname
     */
    public function setGivenname($givenname)
    {
        $this->_givenname = $givenname;
    }

    /**
     * @return string
     */
    public function getFamilyname()
    {
        return $this->_familyname;
    }

    /**
     * @param string $familyname
     */
    public function setFamilyname($familyname)
    {
        $this->_familyname = $familyname;
    }

    /**
     * @return string
     */
    public function getDob()
    {
        return ($this->_dob == null) ? null : $this->_dob->format('Y-m-d');
    }

    /**
     * @param string $dob
     */
    public function setDob($dob)
    {
        $this->_dob = ($dob == null) ? null : DateTime::createFromFormat('Y-m-d', $dob);
    }
    
    /**
     * @return string
     */
    public function getGender()
    {
        return $this->_gender;
    }

    /**
     * @param string $gender
     */
    public function setGender($gender)
    {
        $this->_gender = $gender;
    }
    
}
